function [componentArray,error]=obtainUniversal(stage,stageType)
C=[0.47e-6, 1e-9, 1e-12, 1e-6, 1.2e-9, 1.2e-12, 1.5e-9, 1.5e-12, 1.8e-9, 1.8e-12, 10e-9, 10e-12, 10e-6, 100e-9, 100e-12, 100e-6, 1000e-12, 1000e-6, 12e-9, 12e-12, 120e-9, 120e-12, 15e-9, 150e-9, 150e-12, 18e-9, 18e-12, 180e-9, 180e-12, 2.2e-9, 2.2e-12, 2.2e-6, 2.7e-9, 2.7e-12, 22e-9, 22e-12, 22e-6, 220e-9, 220e-12, 220e-6, 2200e-6, 27e-9, 27e-12, 270e-9, 270e-12, 3.3e-9, 3.3e-12, 3.3e-6, 3.9e-9, 3.9e-12, 33e-9, 33e-12, 33e-6, 330e-9, 330e-12, 330e-6, 3300e-6, 39e-9, 39e-12, 390e-9, 390e-12, 4.7e-9, 4.7e-12, 4.7e-6, 47e-9, 47e-12, 47e-6, 470e-9, 470e-12, 470e-6, 4700e-6, 5.6e-9, 5.6e-12, 56e-9, 56e-12, 560e-9, 560e-12, 6.8e-9, 6.8e-12, 680e-9, 680e-12, 8.2e-9, 8.2e-12, 82e-9, 82e-12, 820e-12];

bandPass=1;
lowPass=2;
highPass=3;
rejectBand=4;

error=1;

Rmin=10000;
Rmax=5000000;
wo=abs(stage.stagePoles(1)); 
Q=abs(stage.stagePoles(1)/(2*real(stage.stagePoles(1))));
gain=stage.stageGain;

 if(stageType==lowPass)%pasa bajos
     
     R6=inf;
     R4=inf;
     R2=10000;
     R8=5000;
     R7=5000;
     R5=gain*R2;
     for i=1:length(C)
         R3(i)=1/(R2*(wo*C(i))^2);
         R1(i)=Q*sqrt(R2*R3(i));
     end
     for j=1:length(2*C)
     index=random('unid',length(C));
         if(Rmin<R1(index) && R1(index)<Rmax && Rmin<R3(index) && R3(index)<Rmax)
            componentArray=[R1(index) R2 R3(index) R4 R5 R6 R7 R8 C(index) C(index)];
            error=0;
            break
         end
     end
 end

if(stageType==highPass)
    R5=inf;
    R6=22000;
    R2=10000;
    Rmin=5000;
    
        
        for i=1:length(C)
             R3(i)=1/(R2*(wo*C(i))^2);
             R1(i)=Q*sqrt(R2*R3(i));
             R4(i)=R1(i)/gain;
             %for j=1:length(C)
                R8(i)=(R1(i)/R4(i))*R6;
                R7=R8;
           %  end
        end
         
    for j=1:length(2*C)
     index=random('unid',length(C));
         if(Rmin<R1(index) && R1(index)<Rmax && Rmin<R3(index) && R3(index)<Rmax && Rmin<R8(index) && R8(index)<Rmax && Rmin<R4(index) && R4(index)<Rmax && Rmin<R7(index) && R7(index)<Rmax)
            componentArray=[R1(index) R2 R3(index) R4(index) inf R6 R7(index) R8(index) C(index) C(index)];
            error=0;
            break
         end
     end
end

    if(stageType==bandPass)
        
        R5=inf;
        R6=inf;
        R7=10000;
        R8=10000;
        R2=10000;
        
        for i=1:length(C)
             R3(i)=1/(R2*(wo*C(i))^2);
             R1(i)=Q*sqrt(R2*R3(i));
             R4(i)=R1(i)/gain;
        end
        
        
     for j=1:length(2*C)
     index=random('unid',length(C));
         if(Rmin<R1(index) && R1(index)<Rmax && Rmin<R3(index) && R3(index)<Rmax && Rmin<R4(index) && R4(index)<Rmax)
            componentArray=[R1(index) R2 R3(index) R4(index) inf inf R7 R8 C(index) C(index)];
            error=0;
            break
         end
     end
        
        
    end
    
    if(stageType==rejectBand)
        
        R2=10000;
        R6=10000;
        
        
        for i=1:length(C)
         R3(i)=1/(R2*(wo*C(i))^2);
         R1(i)=Q*sqrt(R2*R3(i));
         R4(i)=R1(i)/gain;
         R5(i)=R2/gain;
         R8(i)=(R1(i)/R4(i))*R6;
         R7(i)=R(i);
        end
        
           
     for j=1:length(2*C)
     index=random('unid',length(C));
         if(Rmin<R1(index) && R1(index)<Rmax && Rmin<R3(index) && R3(index)<Rmax && Rmin<R8(index) && R8(index)<Rmax && Rmin<R4(index) && R4(index)<Rmax && Rmin<R5(index) && R5(index)<Rmax && Rmin<R7(index) && R7(index)<Rmax)
            componentArray=[R1(index) R2 R3(index) R4(index) R5(index) R6 R7(index) R8(index) C(index) C(index)];
            error=0;
            break
         end
     end
        
    end
    
    if(error==1)
        componentArray(1:10)=inf;
    end


end
